require(['./config'], () => {
    require(['server', 'template', 'pagebar', 'nav', 'foot'], (server, template, pagebar) => {
        class Gift {
            constructor() {
                this.init()
            }
            init() {
                $('.main .father-class .series').on('click', 'a', function() {
                    open('/html/category.html?' + $(this).parents('.father-class').attr('type-title') + '=' + $(this).attr('je-type'));
                })

                $.get(server.baseServerUrl + '/api/goods/list', resp => {
                    let res = resp.body.list
                    res = res.map(function(item) {
                        if (item.img.indexOf('@') != -1) {
                            item.img = item.img.slice(0, item.img.indexOf('@'))
                        }
                        return item
                    })
                    let resRings = res.filter((item) => item['jewelryType'] == 'rings');

                    pagebar.render({ count: resRings.length, limit: 8, ele: '#ring-good-list', list: resRings, templateid: 'ring-list-template' })

                })
            }
        }
        new Gift()
    })
})